package com.example.ch53;

import com.example.filesystem.Directory;
import com.example.filesystem.FileNode;
import com.example.filesystem.File;

/**
 * Hello world!
 *
 */
public class App {
    public static void main(String[] args) {
        /**
         * /
         * /wz/
         * /wz/a.txt
         * /wz/b.txt
         * /wz/movies/
         * /wz/movies/c.avi
         * /xzg/
         * /xzg/docs/
         * /xzg/docs/d.txt
         * /xzg/docs/e.txt
         */

        FileNode root = new Directory("/");
        FileNode dir1 = new Directory("/wz/");
        FileNode dir1_file1 = new File("/wz/a.txt");
        FileNode dir1_file2 = new File("/wz/b.txt");
        dir1.addNode(dir1_file1);
        dir1.addNode(dir1_file2);
        FileNode dir1_dir2 = new Directory("/wz/movies/");
        dir1.addNode(dir1_dir2);
        FileNode dir1_dir2_file3 = new File("/wz/movies/c.avi");
        dir1_dir2.addNode(dir1_dir2_file3);
        root.addNode(dir1);


        FileNode dir2 = new Directory("/xzg/");
        FileNode dir2_dir1 = new Directory("/xzg/docs/");
        FileNode dir2_dir1_file1 = new File("/xzg/docs/d.txt");
        FileNode dir2_dir1_file2 = new File("/xzg/docs/e.txt");
        dir2_dir1.addNode(dir2_dir1_file1);
        dir2_dir1.addNode(dir2_dir1_file2);
        dir2.addNode(dir2_dir1);
        root.addNode(dir2);

        Integer sizeOfFile = root.calculateSizeOfFile();
        System.out.println("sizeOfFile:" + sizeOfFile);
        Integer numOfFile = root.calculateNumOfFile();
        System.out.println("numOfFile:" + numOfFile);
    }
}
